package com.ymatou.iapi.pushbind.testcase;

import com.ymatou.iapi.pushbind.parameter.BindUserClientBean;
import com.ymatou.iapi.pushbind.parameter.CleanBindDataBean;
import com.ymatou.iapi.pushbind.service.CleanBindDataCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.PushCallService;
import com.ymttest.database.sqlwapper.ImDefaultWapper;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.util.Random;

/**
*清理过期绑定数据Job
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_CleanBindData{
	private static CleanBindDataBean cleanbinddataBean;
	private static CleanBindDataCall cleanbinddataCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("清理过期绑定数据Job");
	}

	@Before
	public void caseUp() {
		cleanbinddataBean=new CleanBindDataBean();
		cleanbinddataCall=new CleanBindDataCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(cleanbinddataCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	//需要手工修改redis的score
	public void Tc_CleanBindData_001() {
		Logger.start(true,"清理过期绑定数据Job");
		try {
			int userId = new Random().nextInt(10000);
			BindUserClientBean bindUserClientBean1 = PushCallService.intitUserClient(userId);
			//绑定用户客户端
			PushCallService.bindUserClient(bindUserClientBean1);
			ImDefaultWapper im = new ImDefaultWapper();
			cleanbinddataBean.setMaxUserId(100000);
			cleanbinddataCall.setData(cleanbinddataBean);
			cleanbinddataCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}